﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="EditEmployees.aspx.cs" Inherits="Admin_EditEmployees" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 138px;
        }
        .style2
        {
            width: 250px;
        }
        .style3
        {            
            text-align:left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="innerContent" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <img src="Images/img-table-1.gif" />
            </td>
            <td width="100%" class="table-bg-1">
            </td>
            <td>
                <img src="Images/img-table-2.gif" />
            </td>
        </tr>
        <tr>
            <td class="table-bg-2">
                &nbsp;
            </td>
            <td>
                <div class="heading">
                    <img src="Images/img-heading-box.gif" align="absmiddle" />
                    &nbsp; Manage Employees</div>
                <div class="strip">
                </div>
                <br />
                
                <table cellpadding="0" width="100%">
                    <tr>
                        <td>
                            <asp:Label runat="server" ID="lblError" CssClass="failureNotification"></asp:Label>
                        </td>
                    </tr> 
                    <tr>
                        <td>
                            <table cellpadding="5" width="100%">
                            <tr>
                        <td align="right" class="style1">
                            First Name*:
                        </td>
                        <td class="style2">
                            <asp:TextBox runat="server" ID="txtFirstName" Width="230" MaxLength="20" CssClass="textboxcss"></asp:TextBox>
                        </td>
                        <td class="style3">
                            
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="txtFirstName" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="First Name is required." SetFocusOnError="True" 
                                ValidationGroup="vgSubmit"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                    ControlToValidate="txtFirstName" Display="Dynamic"  CssClass="grdv-empty-style"
                                    ErrorMessage="Invalid First Name" SetFocusOnError="True" 
                                    ValidationExpression="^([A-Za-z]+)$" ValidationGroup="vgSubmit"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style1">
                            Last Name*:
                        </td>
                        <td class="style2">
                            <asp:TextBox runat="server" ID="txtLastName" Width="230" MaxLength="20" CssClass="textboxcss"></asp:TextBox>
                        </td>
                        <td class="style3">
                            
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ControlToValidate="txtLastName" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="Last Name is required." SetFocusOnError="True" 
                                ValidationGroup="vgSubmit"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                    ControlToValidate="txtLastName" Display="Dynamic"  CssClass="grdv-empty-style"
                                    ErrorMessage="Invalid Last Name" SetFocusOnError="True" 
                                    ValidationExpression="^([A-Za-z]+)$" ValidationGroup="vgSubmit"></asp:RegularExpressionValidator>
                        </td>
                    </tr>

                    <tr>
                        <td align="right" class="style1">
                            User Name*:
                        </td>
                        <td class="style2">
                            <asp:TextBox runat="server" ID="txtUserName" Width="230" MaxLength="20" CssClass="textboxcss"></asp:TextBox>
                        </td>
                        <td class="style3">
                            
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ControlToValidate="txtUserName" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="User Name is required." SetFocusOnError="True" 
                                ValidationGroup="vgSubmit"></asp:RequiredFieldValidator>
                            
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style1">
                            Password*:
                        </td>
                        <td class="style2">
                            <asp:TextBox runat="server" ID="txtPassword" Width="230" MaxLength="20" CssClass="textboxcss"></asp:TextBox>
                        </td>
                        <td class="style3">
                            
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="txtPassword" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="Password is required." SetFocusOnError="True" 
                                ValidationGroup="vgSubmit"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                     ControlToValidate="txtPassword" Display="Dynamic" ErrorMessage="Your Password must be 8 characters in length and contain atleast one number, one uppercase, one lower case, and one special character." 
                                     SetFocusOnError="True"  ForeColor="#ff0000"
                                     ValidationExpression="^.*(?=.{8,25})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$" 
                                     ValidationGroup="vgSubmit"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style1">
                            Email*:
                        </td>
                        <td class="style2">
                            <asp:TextBox runat="server" ID="txtEmail" Width="230" MaxLength="34" CssClass="textboxcss"></asp:TextBox>
                        </td>
                        <td class="style3">
                            
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                ControlToValidate="txtEmail" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="Email is required." SetFocusOnError="True" 
                                ValidationGroup="vgSubmit"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="txtEmail" CssClass="grdv-empty-style" Display="Dynamic" 
                                ErrorMessage="Email is invalid." SetFocusOnError="True" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                                ValidationGroup="vgSubmit"></asp:RegularExpressionValidator>
                            
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style1">
                            Is Approved:
                        </td>
                        <td class="style2">
                            <asp:CheckBox ID="chkApproved" runat="server" Text="Approved" />
                        </td>
                        <td>
                            
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            &nbsp;
                        </td>
                        <td align="left" class="style2">
                            <asp:Button runat="server" ID="btnSubmit" ValidationGroup="vgSubmit" Text="Submit"
                                OnClick="btnSubmit_Click" />
                            <asp:Button runat="server" Visible="false" ID="btnUpdate" ValidationGroup="vgSubmit"
                                Text="Update" OnClick="btnUpdate_Click" />                           
                            <asp:HiddenField runat="server" ID="hidId" />
                        </td>
                        <td>
                            
                        </td>
                    </tr>
                            </table>
                        </td>
                    </tr> 
                    <tr>
                        <td>
                            <asp:GridView ID="grvEmployees" HorizontalAlign="Center" CellPadding="5" runat="server"
                                AutoGenerateColumns="False" AllowPaging="true" PageSize="10" CssClass="grdv-style"
                                DataKeyNames="Id" EmptyDataText="No Records found." OnPageIndexChanging="grvEmployees_PageIndexChanging"
                                OnRowCommand="grvEmployees_RowCommand" OnRowUpdating="grvEmployees_RowUpdating"
                                OnRowDeleting="grvEmployees_RowDeleting">
                                <Columns>
                                    <asp:TemplateField HeaderText="First Name">
                                        <ItemTemplate>                                            
                                            <asp:Label ID="lblFirstName" runat="server" Text='<%#Eval("FirstName")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Last Name">
                                        <ItemTemplate>
                                            <asp:Label ID="lblLastName" runat="server" Text='<%#Eval("LastName")%>'
                                                ></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="User Name">
                                        <ItemTemplate>
                                            <asp:Label ID="lblUserName" runat="server" Text='<%#Eval("UserName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Email">
                                        <ItemTemplate>
                                            <asp:Label ID="lblEmail" runat="server" Text='<%#Eval("Email") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Password">
                                        <ItemTemplate>
                                            <asp:Label ID="lblPassword" runat="server" Text='<%#Eval("Password") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Approved">
                                        <ItemTemplate>
                                            <asp:Label ID="lblApproved" runat="server" Text='<%#Eval("Approved") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Action" HeaderStyle-Width="75px">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" CommandName="Delete"
                                                OnClientClick="return confirm('Are you sure to delete this Record?');" CommandArgument='<%#Eval("Id")%>'></asp:LinkButton>
                                            <asp:LinkButton ID="lnkEdit" runat="server" Text="Edit" CommandName="Update" CommandArgument='<%#Eval("Id")%>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <%--<asp:TemplateField HeaderText="Edit">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkEdit" Width="80px" runat="server" Text="Edit" CommandName="Update" CommandArgument='<%#Eval("ProductID")%>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>--%>
                                </Columns>
                                <HeaderStyle CssClass="grdv-header-style" />
                                <RowStyle CssClass="grdv-row-style" />
                                <AlternatingRowStyle CssClass="grdv-altrow-style" />
                                <FooterStyle CssClass="grdv-footer-style" />
                                <PagerStyle CssClass="grdv-pager-style" />
                                <EmptyDataRowStyle CssClass="grdv-empty-style" />
                            </asp:GridView>
                        </td>
                    </tr> 
                    
                </table>
                <br />
                <br />
                <div class="cl">
                </div>
            </td>
            <td class="table-bg-3">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <img src="Images/img-table-3.gif" />
            </td>
            <td class="table-bg-4">
            </td>
            <td>
                <img src="Images/img-table-4.gif" />
            </td>
        </tr>
    </table>
</asp:Content>

